package com.crm.pojo;

import com.alibaba.fastjson.annotation.JSONField;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the SALE_PLAN database table.
 */
@Entity
@Table(name = "SALE_PLAN")
@NamedQuery(name = "SalePlan.findAll", query = "SELECT s FROM SalePlan s")
public class SalePlan implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(initialValue = 1, allocationSize = 1, name = "SALE_PLAN_PLANID_GENERATOR", sequenceName = "SEQ1")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SALE_PLAN_PLANID_GENERATOR")
    @Column(name = "PLAN_ID")
    private Long planId;

    @Column(name = "EXPENSE_BUDGET")
    private BigDecimal expenseBudget;

    @Column(name = "GOAL_CLIENT_ID")
    private BigDecimal goalClientId;

    @Column(name = "GOAL_TOTAL_COUNT")
    private BigDecimal goalTotalCount;

    @Column(name = "GOAL_TOTAL_MONEY")
    private BigDecimal goalTotalMoney;

    @Column(name = "PLAN_CHECK")
    private String planCheck;

    @Column(name = "PLAN_NAME")
    private String planName;

    @Column(name = "SALE_PLAN_IS_DEL")
    private String salePlanIsDel;

    @Temporal(TemporalType.DATE)
    @Column(name = "SET_TIME")
    @JSONField(format = "yyyy-MM-dd")
    private Date setTime;

    @Column(name = "STRATEGY_PRICE")
    private String strategyPrice;

    @Column(name = "STRATEGY_PRODUCT")
    private String strategyProduct;

    @Temporal(TemporalType.DATE)
    @Column(name = "UPDATE_DATE")
    @JSONField(format = "yyyy-MM-dd")
    private Date updateDate;

    @Column(name = "USER_ID")
    private BigDecimal userId;

    //bi-directional many-to-one association to PlanDetail
    @JSONField(serialize = false)
    @OneToMany(mappedBy = "salePlan")
    private List<PlanDetail> planDetails;

    public SalePlan() {
    }

    public Long getPlanId() {
        return this.planId;
    }

    public void setPlanId(Long planId) {
        this.planId = planId;
    }

    public BigDecimal getExpenseBudget() {
        return this.expenseBudget;
    }

    public void setExpenseBudget(BigDecimal expenseBudget) {
        this.expenseBudget = expenseBudget;
    }

    public BigDecimal getGoalClientId() {
        return this.goalClientId;
    }

    public void setGoalClientId(BigDecimal goalClientId) {
        this.goalClientId = goalClientId;
    }

    public BigDecimal getGoalTotalCount() {
        return this.goalTotalCount;
    }

    public void setGoalTotalCount(BigDecimal goalTotalCount) {
        this.goalTotalCount = goalTotalCount;
    }

    public BigDecimal getGoalTotalMoney() {
        return this.goalTotalMoney;
    }

    public void setGoalTotalMoney(BigDecimal goalTotalMoney) {
        this.goalTotalMoney = goalTotalMoney;
    }

    public String getPlanCheck() {
        return this.planCheck;
    }

    public void setPlanCheck(String planCheck) {
        this.planCheck = planCheck;
    }

    public String getPlanName() {
        return this.planName;
    }

    public void setPlanName(String planName) {
        this.planName = planName;
    }

    public String getSalePlanIsDel() {
        return this.salePlanIsDel;
    }

    public void setSalePlanIsDel(String salePlanIsDel) {
        this.salePlanIsDel = salePlanIsDel;
    }

    public Date getSetTime() {
        return this.setTime;
    }

    public void setSetTime(Date setTime) {
        this.setTime = setTime;
    }

    public String getStrategyPrice() {
        return this.strategyPrice;
    }

    public void setStrategyPrice(String strategyPrice) {
        this.strategyPrice = strategyPrice;
    }

    public String getStrategyProduct() {
        return this.strategyProduct;
    }

    public void setStrategyProduct(String strategyProduct) {
        this.strategyProduct = strategyProduct;
    }

    public Date getUpdateDate() {
        return this.updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public BigDecimal getUserId() {
        return this.userId;
    }

    public void setUserId(BigDecimal userId) {
        this.userId = userId;
    }

    public List<PlanDetail> getPlanDetails() {
        return this.planDetails;
    }

    public void setPlanDetails(List<PlanDetail> planDetails) {
        this.planDetails = planDetails;
    }

    public PlanDetail addPlanDetail(PlanDetail planDetail) {
        getPlanDetails().add(planDetail);
        planDetail.setSalePlan(this);

        return planDetail;
    }

    public PlanDetail removePlanDetail(PlanDetail planDetail) {
        getPlanDetails().remove(planDetail);
        planDetail.setSalePlan(null);

        return planDetail;
    }

}